<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "grp_shop_position".
 *
 * @property integer $id
 * @property integer $brand_id
 * @property string $sales_name
 * @property string $province
 * @property string $city
 * @property string $address
 * @property string $tel
 * @property string $longitude
 * @property string $latitude
 * @property string $person
 */
class GrpShopPosition extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'grp_shop_position';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['longitude','latitude','brand_id','city'], 'required'],
            [['brand_id'], 'integer'],
            [['longitude', 'latitude'], 'number'],
            [['sales_name'], 'string', 'max' => 60],
            [['province', 'city'], 'string', 'max' => 30],
            [['address'], 'string', 'max' => 80],
            [['tel','person'], 'string', 'max' => 20]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app','ID'),
            'brand_id' => Yii::t('app','Brand ID'),
            'sales_name' => Yii::t('app','Sales Name'),
            'province' => Yii::t('app','Province'),
            'city' => Yii::t('app','City'),
            'address' => Yii::t('app','Address'),
            'tel' => Yii::t('app','Tel'),
            'longitude' => Yii::t('app','Longitude'),
            'latitude' => Yii::t('app','Latitude'),
			'person' => Yii::t('app','Shop Person'),
        ];
    }
    public function getBrandName()
    {
    	return $this->hasOne(GrpBrand::className(),['id'=>'brand_id']);
    }
}
